$(document).ready(function () {
    $.getJSON('/Home/AjaxBrowse', { page: p ? p : 1 }, function (data) {
        var output = '';
        $.each(data.users, function (key, entity) {
            output += '<li><div class="slidera_img"><a href="/image/viewImage/' + entity.ImageId + '" rel="example_group">'
                + '<img  src="/image/viewimage/' + entity.ImageId + '"?imageType=thumb" width="100" height="100" /></a></div></li>';
        });

        $("#namesList").attr("start", data.pager.FirstItemOnPage).html(output);
        $("#namesPager").html(pagedList.render(data.pager));
    }).error(function () {

        });

    $("a[rel=example_group]").livequery(function () {
        $(this).fancybox({
            'transitionIn': 'none',
            'transitionOut': 'none',
            'titlePosition': 'over',
            'type': 'image',
            'titleFormat': function (title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">' + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
        });
    });
});

